<?php
/**
 * Created by PhpStorm.
 * User: XT
 * Date: 2017/4/17
 * Time: 14:26
 * 支持 EloquentModel 原本的各项操作
 */
namespace core;

use Illuminate\Database\Eloquent\Model as EloquentModel;

class Model extends EloquentModel  {

    protected $connection = 'default';

    /**
     * Model constructor.
     * @param array $attributes
     */
    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        $this->connect();
    }

    /**
     * 连接数据库
     */
    public function connect()
    {
        return DB::connect($this->connection);
    }


}